package com.rfsp;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.session.jdbc.config.annotation.web.http.EnableJdbcHttpSession;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.thymeleaf.spring5.view.ThymeleafViewResolver;

import com.rfsp.common.util.SpringUtil;

import tk.mybatis.spring.annotation.MapperScan;

@EnableCaching
@EnableScheduling
@EnableFeignClients
@SpringBootApplication
@EnableTransactionManagement
@MapperScan("com.rfsp.*.mapper")
@EnableJdbcHttpSession(tableName = "mcp_spring_session")
public class McpApplication extends SpringBootServletInitializer {

	private static final Logger logger = LoggerFactory.getLogger(McpApplication.class);
	
	public static void main(String[] args) {
		SpringApplication.run(McpApplication.class, args);
		
		ThymeleafViewResolver thymeleafViewResolver = SpringUtil.getBean(ThymeleafViewResolver.class);
		thymeleafViewResolver.setRedirectHttp10Compatible(false);
	}

	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
		return builder.sources(McpApplication.class);
	}
}